class Solution:
    def get_pair_count(self, arr):
        # write code here
        return self.getpair(arr)

    def getpair(self, arr):
        c = 0
        dic = {}
        for i in arr:
            dic[i] = 0
        for i in arr:
            if i + 1 in dic:
                dic[i] += 1
        for i in dic:
            if dic[i] > 0:
                c += 1
        return c

###2
class Solution:
    def get_pair_count(self , arr ):
        # write code here
        res = []
        for i in arr:
            if i+1 in arr:
                if i not in res:
                    res.append(i)
        return len(res)